<!-- 
说明：商品规格表列表
作者：292303959@qq.com
日期：2018-10-17 10:5:30
版本：1.0.0
-->
<template>
  <div>
    <mk-search-box>
      <el-row>
        <el-col :span="5">
          <label>商品ID:</label>
          <el-input v-model="ui.searchData.pdid"
                    size="small"></el-input>
        </el-col>
        <el-col :span="5">
          <label>规格名称:</label>
          <el-input v-model="ui.searchData.psname"
                    size="small"></el-input>
        </el-col>
        <el-col :span="5">
          <label>商品单位:</label>
          <el-input v-model="ui.searchData.pdunit"
                    size="small"></el-input>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="5">
          <label>价格:</label>
          <el-input v-model="ui.searchData.psprice"
                    size="small"></el-input>
        </el-col>
        <el-col :span="3">
          <mk-search-buttons v-model="ui.searching" />
        </el-col>
      </el-row>
    </mk-search-box>
    <el-row>
      <add @reload="doSearch" />
    </el-row>
    <mk-table v-model="ui"
              mk-multiple
              mk-index
              mk-sql-code="tProductSpec.select_list"
              mk-table-id="t-product-spec.list.common"
              ref="table">
      <el-table-column align="left"
                       prop="pdid"
                       label="商品ID"
                       sortable="custom"
                       width="32" />
      <el-table-column align="left"
                       prop="psname"
                       label="规格名称"
                       sortable="custom"
                       width="500" />
      <el-table-column align="left"
                       prop="pdunit"
                       label="商品单位"
                       sortable="custom"
                       width="20" />
      <el-table-column align="left"
                       prop="psprice"
                       label="价格"
                       sortable="custom"
                       width="18" />
      <el-table-column prop="doing"
                       align="center"
                       label="操作"
                       width="120">
        <template slot-scope="scope">
          <edit :row="scope.row"
                @reload="doSearch" />
        </template>
      </el-table-column>
    </mk-table>
  </div>
</template>

<script>
  import {
    MkBase
  } from 'element-ui'
  import Add from './list/add-button'
  import Edit from './list/edit-button'
  import searchData from './list/search-data'

  export default {
    name: 't-product-spec-list',
    mixins: [MkBase],
    components: {
      Add,
      Edit
    },
    data () {
      return {
        ui: {
          searching: true,
          searchData: searchData()
        }
      }
    },
    methods: {
      /**
       * 刷新本页面
       */
      doSearch () {
        this.ui.searching = true
      }
    }
  }
</script>